﻿namespace Assets.XyzCode.Fight.Game.Enemy
{
    partial class Enemy_X_Behav
    {
        /// <summary>
        /// 是否可以切换到新状态
        /// </summary>
        /// <param name="newState">新状态</param>
        /// <returns>true = 可以, false = 不可以</returns>
        private bool CanSwitchStateTo(StateEnum newState)
        {
            if (StateEnum.Wound == newState 
             || StateEnum.HitAway == newState)
            {
                // 可以从任何状态切换到受伤和击飞状态
                return true;
            }

            if (StateEnum.Unknown == _currState)
            {
                // 从未知状态可以切换到任何状态
                return true;
            }
            else
            if (StateEnum.Stand == _currState)
            {
                if (StateEnum.Run == newState
                 || StateEnum.Punch == newState)
                {
                    return true;
                }
            }
            else
            if (StateEnum.Run == _currState)
            {
                if (StateEnum.Stand == newState
                 || StateEnum.Punch == newState)
                {
                    return true;
                }
            }

            return false;
        }
    }
}
